package com.survey.wxapp.controller;

import com.survey.common.annotation.Anonymous;
import com.survey.common.core.controller.BaseController;
import com.survey.wxapp.common.wxconfig.DisWxuserConstants;
import com.survey.wxapp.util.WxLoginUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Anonymous
@RestController
@RequestMapping("/wx/getPhone")
public class WxGetPhoneController extends BaseController {
    @PostMapping("/getPhoneNumber")
    public String getPhoneNumber(@RequestBody String code) throws Exception {
        String phoneNumber = WxLoginUtil.getPhoneNumber(code, DisWxuserConstants.APPID, DisWxuserConstants.STRING);
        return phoneNumber;
    }
}
